Update Language::userAdjust() $ts parameter hint to be string
authorReedy <reedy@wikimedia.org>
Wed, 18 Jun 2014 21:53:07 +0000 (22:53 +0100)
committerReedy <reedy@wikimedia.org>
Wed, 18 Jun 2014 22:00:23 +0000 (23:00 +0100)
Will technically still take an int (it's parsed around anyway), but
should be passed as a string

Mostly for HipHop stuffs

Change-Id: Id940028d581e34ca2e37a0730ca5766a08fc10e2

languages/Language.php
tests/phpunit/includes/TimeAdjustTest.php

index 9d3f5e9..e505b28 100644 (file)
@@ -1880,7 +1880,7 @@ class Language {
        /**
         * Used by date() and time() to adjust the time output.
         *
-        * @param int $ts The time in date('YmdHis') format
+        * @param string $ts The time in date('YmdHis') format
         * @param mixed $tz Adjust the time by this amount (default false, mean we
         *   get user timecorrection setting)
         * @return int
@@ -2020,7 +2020,7 @@ class Language {
        }
 
        /**
-        * @param mixed $ts The time format which needs to be turned into a
+        * @param string $ts The time format which needs to be turned into a
         *   date('YmdHis') format with wfTimestamp(TS_MW,$ts)
         * @param bool $adj Whether to adjust the time output according to the
         *   user configured offset ($timecorrection)
@@ -2039,7 +2039,7 @@ class Language {
        }
 
        /**
-        * @param mixed $ts The time format which needs to be turned into a
+        * @param string $ts The time format which needs to be turned into a
         *   date('YmdHis') format with wfTimestamp(TS_MW,$ts)
         * @param bool $adj Whether to adjust the time output according to the
         *   user configured offset ($timecorrection)
@@ -2058,7 +2058,7 @@ class Language {
        }
 
        /**
-        * @param mixed $ts The time format which needs to be turned into a
+        * @param string $ts The time format which needs to be turned into a
         *   date('YmdHis') format with wfTimestamp(TS_MW,$ts)
         * @param bool $adj Whether to adjust the time output according to the
         *   user configured offset ($timecorrection)
@@ -2149,7 +2149,7 @@ class Language {
         * Internal helper function for userDate(), userTime() and userTimeAndDate()
         *
         * @param string $type Can be 'date', 'time' or 'both'
-        * @param mixed $ts The time format which needs to be turned into a
+        * @param string $ts The time format which needs to be turned into a
         *   date('YmdHis') format with wfTimestamp(TS_MW,$ts)
         * @param User $user User object used to get preferences for timezone and format
         * @param array $options Array, can contain the following keys:
index 0b368c2..f0d4c4d 100644 (file)
@@ -3,8 +3,6 @@
 class TimeAdjustTest extends MediaWikiLangTestCase {
        protected function setUp() {
                parent::setUp();
-
-               $this->iniSet( 'precision', 15 );
        }
 
        /**
@@ -18,7 +16,7 @@ class TimeAdjustTest extends MediaWikiLangTestCase {
                $this->setMwGlobals( 'wgLocalTZoffset', $localTZoffset );
 
                $this->assertEquals(
-                       strval( $expected ),
+                       $expected,
                        strval( $wgContLang->userAdjust( $date, '' ) ),
                        "User adjust {$date} by {$localTZoffset} minutes should give {$expected}"
                );
@@ -26,16 +24,16 @@ class TimeAdjustTest extends MediaWikiLangTestCase {
 
        public static function dataUserAdjust() {
                return array(
-                       array( 20061231235959, 0, 20061231235959 ),
-                       array( 20061231235959, 5, 20070101000459 ),
-                       array( 20061231235959, 15, 20070101001459 ),
-                       array( 20061231235959, 60, 20070101005959 ),
-                       array( 20061231235959, 90, 20070101012959 ),
-                       array( 20061231235959, 120, 20070101015959 ),
-                       array( 20061231235959, 540, 20070101085959 ),
-                       array( 20061231235959, -5, 20061231235459 ),
-                       array( 20061231235959, -30, 20061231232959 ),
-                       array( 20061231235959, -60, 20061231225959 ),
+                       array( '20061231235959', 0, '20061231235959' ),
+                       array( '20061231235959', 5, '20070101000459' ),
+                       array( '20061231235959', 15,'20070101001459' ),
+                       array( '20061231235959', 60, '20070101005959' ),
+                       array( '20061231235959', 90, '20070101012959' ),
+                       array( '20061231235959', 120, '20070101015959' ),
+                       array( '20061231235959', 540, '20070101085959' ),
+                       array( '20061231235959', -5, '20061231235459' ),
+                       array( '20061231235959', -30, '20061231232959' ),
+                       array( '20061231235959', -60, '20061231225959' ),
                );
        }
 }